class Solution(object):
    def maxProfit(self, prices):
        """
        :type prices: List[int]
        :rtype: int
        """

        if len(prices) == 1 or len(prices) == 0:
            return 0
        sums = 0
        for i in range(len(prices)-1):

                if prices[i] < prices[i+1]:
                    sums+=prices[i+1]-prices[i]


        return sums



# m = [7,1,5,3,6,4]
m = [1,2,3,4,5]
s = Solution()
a = s.maxProfit(m)
print(a)
